import java.util.Collection;
import java.util.TreeSet;




public class Library {
private BookSet<Book> bs;

Library() {bs = new BookSet<Book>();}



Library(Collection<Book> books){
	bs = new BookSet<Book>();
	bs.addAll(books);
}

public boolean sortedInsert(Book newBook) {
	return bs.add(newBook);
}
			
public Book searchISBN(String isbn){
	for(Book c: bs)
		if (c.getISBN().equals(isbn))
			return c;
	return null;
}

public Collection<Book> searchAuthor(String author){
	TreeSet<Book> e = new TreeSet<Book>();
	for(Book c : bs){
		if(c.getAuthor().equals(author))
			e.add(c);
	}
	return e;
}

public String toString(){
	String n = "Library:";
	for(Book i : bs)
		n +="\n"+ i.toString();
	return n;
}

}
